package com.bishe.demo.modules.hotel.hotel.controller;

import com.bishe.demo.modules.common.entity.ResultEntity;
import com.bishe.demo.modules.hotel.hotel.entity.HotelOrder;
import com.bishe.demo.modules.hotel.hotel.service.HotelOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api")
public class HotelOrderController {
    @Autowired
    private HotelOrderService hotelOrderService;

    @PostMapping(value = "/hotelOrder", consumes = "application/json")
    public ResultEntity<HotelOrder> insertHotelOrder(@RequestBody HotelOrder hotelOrder) {
        return hotelOrderService.insertHotelOrder(hotelOrder);
    }

    @GetMapping("/hotelOrders/{userId}")
    public List<HotelOrder> getHotelOrdersByUserId(@PathVariable int userId) {
        return hotelOrderService.getHotelOrdersByUserId(userId);
    }
}
